/*
	Copyright (C) 2008 Demiurg-HG
	
	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
// i_shell.h - shell interface


#pragma once


typedef void (*EShellCmd_f)(void *self, uint argc, const char **argv);

enum	shellFlags_t
	{
		SHLF_READONLY		= 0x0001,	//	prevent changing of this var
		SHLF_NOSAVE			= 0x0002,	//	var will not be saved on config
		SHLF_FORCE_DWORD	= 0x7FFFFFFF,
	};


interface	IVar
	{
		virtual				~IVar		( void ) {};
		
		virtual const char	*Name			( void ) const = 0;
		
		virtual const char	*String			( void ) const = 0;
		virtual const char	*Default		( void ) const = 0;
		virtual void		ResetValue		( void ) = 0;
		virtual void		SetValue		( const char *val ) = 0;
		
		virtual int			Int				( void ) const = 0;
		virtual float		Float			( void ) const = 0;
		virtual uint		Flags			( void ) const = 0;
		virtual EVec4		Vec4			( void ) const = 0;
		virtual EVec3		Vec3			( void ) const = 0;
		virtual EVec2		Vec2			( void ) const = 0;
	};


interface	IShell {
		virtual			~IShell	( void ) {}
		
		virtual	IVar		*RegisterVar			( const char *name, const char *value, uint flags ) = 0;
		
		virtual void		AddCommand				( const char *name, EShellCmd_f cmd_func, void *self ) = 0;
		virtual void		RemoveCommand			( const char *name ) = 0;
		
		virtual void		ExecuteString			( const char *cmd_text ) = 0;
		virtual void		ExecuteEnqueuedCommands ( void ) = 0;
		virtual void		ExecuteDelayedCommand	( int delta_time ) = 0;
		
		virtual void		ExecuteConfig			( const char *file_name ) = 0;
		virtual void		WriteConfig				( const char *file_name ) = 0;
		
		virtual const char	*CompleteCommand		( const char *text ) = 0;
	};
	
	
	
